﻿using System;
using System.Collections;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;
using ncp.Business.Common;
using ncp.Business;

namespace ncp.Web.handler
{
    /// <summary>
    /// $codebehindclassname$ 的摘要说明
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class CookieHandler : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            var managerCookie = context.Request.Form["type"];
            UserInfo userInfo;
            if (managerCookie==null)
            {
                userInfo = WebMasterCookie.GetCookie();
            }
            else
            {
                userInfo = WebMasterCookie.GetCookie(CommonConst.adminCookieName);
            }
            if (userInfo==null)
            {
                context.Response.Write("");
            }
            else
            {
                context.Response.Write(userInfo.UName);
            }
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}
